// 这个模块的职责是配置路由

// 导入包
import Vue from 'vue'
import VueRouter from 'vue-router'


// 导入组件
import HoreList from './views/HoreList.vue'
import HoreAdd from './views/HoreAdd.vue'
import HoreEdit from './views/HoreEdit.vue'
import ZbList from './views/ZbList.vue'
import JnList from './views/JnList.vue'

// 使用插件
Vue.use(VueRouter)

// 配置路由规则
const routes = [
  // 让首页默认跳转英雄列表
  { path: '/', redirect: '/hore' },
  { path: '/hore', component: HoreList },
  { path: '/hore/add', component: HoreAdd },
  { path: '/hore/edit/:id', component: HoreEdit },
  { path: '/zb', component: ZbList },
  { path: '/jn', component: JnList },
]

// 实例化
const router = new VueRouter({ routes, linkExactActiveClass: 'active' })


// router需要在vue根实例下挂载
// 1. 导出 router 实例
// 2. 在main.js导入router实例，进行挂载即可
export default router